package com.fbj.exam.dao.imp;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.fbj.exam.dao.HibernateSessionFactory;
import com.fbj.exam.dao.IDao;

public class DaoImp implements IDao {
	private Query query;
	private Session session;
	private Transaction tx;

	public Session getSession() {
		return HibernateSessionFactory.getSession();
	}
	
	public void beginTx() {
		if(null!=session && session.isOpen()){
			tx=session.beginTransaction();
		}else{
			session = getSession();
			session.beginTransaction();
		}
	}

	public void commitTx() {
		if(null == tx || !tx.isActive())
			return;
		tx.commit();
	}

	public void rollback() {
		if(null == tx || !tx.isActive())
			return;
		tx.rollback();
	}

	public boolean addObj(Object obj) {
		// TODO Auto-generated method stub
		return false;
	}

	public void delObj(Object obj) {
		// TODO Auto-generated method stub

	}

	public int delOrUpdate(String hql) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int delOrUpdate(String hql, Object... params) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int delOrUpdateByNamed(String name, Object... params) {
		// TODO Auto-generated method stub
		return 0;
	}

	public <E> List<E> find(String hql) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(String hql, Object... params) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(String hql, int page, int rows) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(String hql, int page, int rows, Object... params) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(E e) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(E e, String orderProperty, boolean isDesc) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(E e, int page, int rows) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> find(E e, int page, int rows, String orderProperty,
			boolean isDesc) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> findByNamedQuery(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> findByNamedQuery(String name, Object... params) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> findByNamedQuery(String name, int page, int rows) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> List<E> findByNamedQuery(String name, int page, int rows,
			Object... params) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> E findObj(String hql) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> E findObj(String hql, Object... params) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> E findObjByNamedQuery(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> E findObjByNamedQuery(String name, Object... params) {
		// TODO Auto-generated method stub
		return null;
	}

	public <E> E get(Class<E> c, Serializable id) {
		// TODO Auto-generated method stub
		return null;
	}

	public int listCount(String hql) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int listCount(String hql, Object... params) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int listCount(Object e) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int listCountByNamedQuery(String name) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int listCountByNamedQuery(String name, Object... params) {
		// TODO Auto-generated method stub
		return 0;
	}

	public void updateObj(Object obj) {
		// TODO Auto-generated method stub

	}

}
